from django.urls import path, re_path
from web.views import account,home, project, manage, wiki, file, setting, issues, dashboard, statistics

urlpatterns = [
    path('sms', account.sms, name='sms'),
    path('register', account.RegisterView.as_view(), name='register'),
    path('login/sms', account.LoginSmsView.as_view(), name='login_sms'),
    re_path(r'^user/active/(?P<token>.*)$', account.Active.as_view(), name='active'),
    path('login', account.LoginView.as_view(), name='login'),
    path('image_code', account.image_code, name='image_code'),   # 该链接是我们生成验证码图片接口，访问一次生成一次
    path('', home.index, name='index'),
    path('logout', home.logout, name='logout'),


    path('price', home.price, name='price'),
    re_path(r'^payment/(?P<policy_id>\d+)$', home.payment, name='payment'),
    path('pay', home.pay, name='pay'),
    path('pay/notify', home.pay_notify, name='pay_notify'),
    path('pay/return', home.pay_return, name='pay_return'),



    # 项目列表
    path('project/list', project.ProjectList.as_view(), name='project_list'),
    # 如果你要星标我的项目     /project/star/my/1（正则用w+）
    # 如果你要星标我参加的项目 /project/star/join/1
    re_path(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)$', project.project_star, name='project_star'),
    re_path(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)$', project.project_unstar,
            name='project_unstar'),


    # wiki首页
    re_path(r'^manage/(?P<project_id>\d+)/wiki$', wiki.wiki, name='wiki'),
    re_path(r'^manage/(?P<project_id>\d+)/wiki/add$', wiki.WikiAdd.as_view(), name='wiki_add'),
    re_path(r'^manage/(?P<project_id>\d+)/wiki/catalog$', wiki.wiki_catalog, name='wiki_catalog'), # wiki目录概览
    re_path(r'^manage/(?P<project_id>\d+)/wiki/delete/(?P<wiki_id>\d+)$', wiki.wiki_delete, name='wiki_delete'),
    re_path(r'^manage/(?P<project_id>\d+)/wiki/edit/(?P<wiki_id>\d+)$', wiki.wiki_edit, name='wiki_edit'),
    re_path(r'^manage/(?P<project_id>\d+)/wiki/upload$', wiki.wiki_upload, name='wiki_upload'),


    re_path(r'^manage/(?P<project_id>\d+)/file$', file.file, name='file'),
    re_path(r'^manage/(?P<project_id>\d+)/file/delete$', file.file_delete, name='file_delete'),
    re_path(r'^manage/(?P<project_id>\d+)/cos/credential$', file.cos_credential, name='cos_credential'),
    re_path(r'^manage/(?P<project_id>\d+)/file/post$', file.file_post, name='file_post'),
    re_path(r'^manage/(?P<project_id>\d+)/file/download/(?P<file_id>\d+)$', file.file_download, name='file_download'),


    re_path(r'^manage/(?P<project_id>\d+)/setting$', setting.setting, name='setting'),
    re_path(r'^manage/(?P<project_id>\d+)/setting/delete$', setting.delete, name='setting_delete'),


    re_path(r'^manage/(?P<project_id>\d+)/issues$', issues.issues, name='issues'),
    re_path(r'^manage/(?P<project_id>\d+)/issues/detail/(?P<issues_id>\d+)$', issues.issues_detail, name='issues_detail'),
    re_path(r'^manage/(?P<project_id>\d+)/issues/record/(?P<issues_id>\d+)$', issues.issues_record, name='issues_record'),
    re_path(r'^manage/(?P<project_id>\d+)/issues/change/(?P<issues_id>\d+)$', issues.issues_change, name='issues_change'),
    re_path(r'^manage/(?P<project_id>\d+)/issues/invite/url$', issues.invite_url, name='invite_url'),
    re_path(r'^invite/join/(?P<code>\w+)$', issues.invite_join, name='invite_join'),


    re_path(r'^manage/(?P<project_id>\d+)/dashboard$', dashboard.dashboard, name='dashboard'),
    re_path(r'^manage/(?P<project_id>\d+)/dashboard/issues/chart$', dashboard.issues_chart, name='issues_chart'),


    re_path(r'^manage/(?P<project_id>\d+)/statistics$', statistics.statistics, name='statistics'),
    re_path(r'^manage/(?P<project_id>\d+)/statistics/priority$', statistics.statistics_priority, name='statistics_priority'),
    re_path(r'^manage/(?P<project_id>\d+)/statistics/project/user$', statistics.statistics_project_user, name='statistics_project_user'),
]

